{{- if .Values.flantIntegration.metrics }}
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: pricing
  namespace: d8-{{ .Chart.Name }}
  {{- include "helm_lib_module_labels" (list . (dict "app" "pricing")) | nindent 2 }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: d8:flant-integration:pricing
  {{- include "helm_lib_module_labels" (list .) | nindent 2 }}
rules:
- apiGroups:
  - ""
  resources:
  - nodes
  - pods
  verbs:
  - get
  - list
  - watch
- apiGroups:
  - deckhouse.io
  resources:
  - nodegroups
  - ingressnginxcontrollers
  verbs:
  - get
  - list
  - watch
- apiGroups:
  - apps
  resources:
  - daemonsets
  - deployments
  - statefulsets
  verbs:
  - get
  - list
  - watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: d8:flant-integration:pricing
  {{- include "helm_lib_module_labels" (list . (dict "app" "pricing")) | nindent 2 }}
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: d8:flant-integration:pricing
subjects:
- kind: ServiceAccount
  name: pricing
  namespace: d8-{{ .Chart.Name }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: d8:flant-integration:pricing:rbac-proxy
  {{- include "helm_lib_module_labels" (list . (dict "app" "pricing")) | nindent 2 }}
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: d8:rbac-proxy
subjects:
  - kind: ServiceAccount
    name: pricing
    namespace: d8-{{ .Chart.Name }}
{{- end }}
